//
// Created by mongobaba on 2021/6/6.
//

#include "unit_test.h"
#include "json_validator.h"

// 空分支
TEST(parse_ws_empty) {
    json_validator validator("");
    ASSERT_EQ(true, validator.parse_ws());
    ASSERT_EQ(std::string(""), validator.left());
}

// 正常情况
TEST(parse_ws_true) {
    const std::string ws("\x20\x0a\x0d\x09");
    for (char c : ws) {
        std::string suffix(" x");
        json_validator validator(c + suffix);
        ASSERT_EQ(true, validator.parse_ws());
        ASSERT_EQ(std::string("x"), validator.left());
    }
}

// 没有空白字符
TEST(parse_ws_no_ws) {
    json_validator validator("x");
    ASSERT_EQ(true, validator.parse_ws());
    ASSERT_EQ(std::string("x"), validator.left());
}
